<?php echo form_open('kupon/postto');?>
<?php echo form_hidden('order_id', $order_id ? $order_id : set_value('order_id'));?>
<table class="standard-table">
	<tr><th>IC Number</th>
    	<td><?php echo form_input(array('name' => 'icno',
			'value' => set_value('icno'),
			'title' => 'IC Number',
			'id' => 'icno'));?><?=form_error('icno')?></td></tr>
    <tr><th>Name</th>
    	<td><?php echo form_input(array('name' => 'fname',
			'value' => set_value('fname'),
			'title' => 'First Name',
			'id' => 'fname'));?><?=form_error('fname')?></td></tr>
	<tr><th>Last Name</th>
    	<td><?php echo form_input(array('name' => 'lname',
			'value' => set_value('lname'),
			'title' => 'Last Name',
			'id' => 'lname'));?><?=form_error('lname')?></td></tr>
	<tr><th>Address</th>
    	<td><?php echo form_textarea(array('name' => 'address',
			'value' => set_value('address'),
			'title' => 'Address',
			'id' => 'address'));?><?=form_error('address')?></td></tr>
	<tr><th>Phone Number</th>
    	<td><?php echo form_input(array('name' => 'phone',
			'value' => set_value('phone'),
			'title' => 'Phone Number',
			'id' => 'phone'));?><?=form_error('phone')?></td></tr>
	<tr><th>Email</th>
    	<td><?php echo form_input(array('name' => 'email',
			'value' => set_value('email'),
			'title' => 'Email',
			'id' => 'email'));?><?=form_error('email')?></td></tr>
</table>
<p><?php echo form_submit('confirm', 'Confirm');?></p>
<?php echo form_close();?>


<script>
	$(function(){
		$("#icno").keyup(function(){
		//alert($("input[name=total_price]").val());
			$.post('<?php echo site_url();?>kupon/ajaxuser',
				{	
					'<?php echo $this->config->item('csrf_token_name'); ?>': '<?php echo $this->security->get_csrf_hash(); ?>',
					'icno' : $("#icno").val(),
				},
				function(data){
					var response = jQuery.parseJSON(data);
					$("#fname").val(response.fname);
					$("#lname").val(response.lname);
					$("#address").val(response.address);
					$("#phone").val(response.phone);
					$("#email").val(response.email);
				}
			);
		});
	});
</script>